<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>蓝科客户管理系统&nbsp;-&nbsp;Powered by ranko.cn！</title>
    <link rel="shortcut icon" type="image/x-icon" href="assets/favicon.ico"/>
    <link rel="stylesheet" type="text/css" href="assets/easyui/themes/bootstrap/easyui.css">
    <link rel="stylesheet" type="text/css" href="assets/easyui/themes/icon.css">
    <script type="text/javascript" src="assets/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="assets/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="assets/easyui/plugin/portal/jquery.portal.js"></script>
    <script type="text/javascript" src="assets/easyui/plugin/easyui.resize.js"></script>
    <script type="text/javascript" src="assets/easyui/plugin/baseloading.js"></script>
    <link rel="stylesheet" type="text/css" href="assets/easyui/plugin/portal/portal.css">
    <link rel="stylesheet" type="text/css" href="assets/style/style.css">
    <script type="text/javascript" src="assets/easyui/easyui-lang-zh_CN.js"></script>
    <link rel="stylesheet" type="text/css" href="assets/easyui/plugin/texteditor/texteditor.css">
    <script type="text/javascript" src="assets/easyui/plugin/texteditor/jquery.texteditor.js"></script>
</head>
<body id="layout_body" class="easyui-layout">
<div data-options="region:'north',split:false" style="height:50px;background: #438EB9;">
    <img src="assets/images/logo_white.png" style="height: 30px;margin-top:10px;margin-left: 10px;">
    <table id="admin_info" style="float: right;">
        <tr>
            <td rowspan="2"><img id="myAvator" src="<?php
                $userinfo = $this->getLastUserInfo();
                echo $userinfo['userimage'] ?>"
                                 style="width: 35px;height: 35px;"/></td>
            <td><?php
                echo Yii::app()->user->realname;
                ?></td>
        </tr>
        <tr>
            <td>
                <span class="left">
                    <a href="index.php?r=site/loginout">退出</a>
                </span>
                <?php
                if (Yii::app()->user->checkAccess('personalconfig_config')) {
                    ?>
                    <span class="right">
                    <a href="javascript:loadWin('个人设置','index.php?r=site/config')">配置</a>
                </span>
                    <?php
                }
                ?>
            </td>
        </tr>
    </table>
</div>
<div data-options="region:'west',split:true,collapsible:false" style="width:180px;">

    <div class="easyui-accordion" data-options="fit:false,animate:false">
        <?php
        if (Yii::app()->user->checkAccess('workspace')) {
            ?>
            <div title="工作台" class="menu_accordion" data-options="iconCls:'icon-menu-chart'" >
                <ul>
                    <?php
                    if (Yii::app()->user->checkAccess('workspace_site')) {
                        ?>
                        <li class="before"><a href="javascript:showTab('控制台','index.php?r=site/index')">控制台</a></li>
                        <?php
                    }
                    ?>
                </ul>
            </div>
            <?php
        }
        ?>
        <?php
        if (Yii::app()->user->checkAccess('sysconfig')) {
            ?>
            <div title="系统设置" class="menu_accordion" data-options="iconCls:'icon-menu-cogs'">
                <ul>
                    <?php
                    if (Yii::app()->user->checkAccess('sysconfig_user_module')) {
                        ?>
                        <li class="before"><a href="javascript:showTab('系统用户','index.php?r=settings/user/index')">系统用户</a>
                        </li>
                        <?php
                    }
                    if (Yii::app()->user->checkAccess('sysconfig_role_module')) {
                        ?>
                        <li class="before"><a href="javascript:showTab('角色权限','index.php?r=settings/role/index')">角色权限</a>
                        </li>
                        <?php
                    }
                    if (Yii::app()->user->checkAccess('sysconfig_picklist_module')) {
                        ?>
                        <li class="before"><a
                                href="javascript:showTab('数据字典','index.php?r=settings/picklist/index')">数据字典</a></li>
                        <?php
                    }
                    if (Yii::app()->user->checkAccess('sysconfig_loginhistory_module')) {
                        ?>
                        <li class="before"><a href="javascript:showTab('登入历史','index.php?r=settings/loginhistory/index')">登入历史</a>
                        </li>
                        <?php
                    }
                    ?>
                </ul>
            </div>
            <?php
        }
        ?>
        </li>
    </div>
</div>
<div data-options="region:'center',border:false">
    <div id="win_main" class="easyui-window" title=""
         data-options="modal:true,closed:true" style="padding: 10px;">
    </div>
    <div id="win_main_2" class="easyui-window" title=""
         data-options="modal:true,closed:true">
    </div>
    <div class="easyui-tabs" data-options="fit:'true'" id="sys_tab">

    </div>
</div>
<script>
    $(function () {
        $('#sys_tab').tabs('add', {
            'title': '控制台',
            'href': 'index.php?r=site/portal'
        });
        $('#layout_body').layout('hidden', 'east');
//        $('#layout_body').layout('unsplit','east');
        $(".menu_accordion").find("ul li").bind("click", function () {
            //将其他的样式背景的active处理掉，然后在当前的li上面加上active
            $(".menu_accordion").find("ul li").removeClass("checkactive");
            $(this).closest("li").addClass("checkactive");
        });

        removeLastBeforeCss();

    });
    function showTab(title, url) {
        var tab = $('#sys_tab').tabs('getTab', title);
        if (tab != null) {
            $('#sys_tab').tabs('select', title);
        } else {
            $('#sys_tab').tabs('add', {
                'title': title,
                'href': url,
                'closable': true
            });
            $('#layout_body').layout('hidden', 'east');
        }
    }
    function layoutresize() {
        $("body").onresize(function () {
            $('#layout_body').layout("resize");
        });
    }
    function loadWin(title, url) {
        $('#win_main').window({
            width: $(window).width() * 0.618,
            height: $(window).height() * 0.618,
            modal: true,
            title: title,
            href: url,
            collapsible: false,
            minimizable: false,
            maximizable: false
        });
        $('#win_main').window('center');
        $('#win_main').window('open');
    }
    function loadWin2(title, url) {
        $('#win_main_2').window({
            width: $(window).width() * 0.618 * 0.618,
            height: $(window).height() * 0.618 * 0.618,
            modal: true,
            title: title,
            href: url,
            collapsible: false,
            minimizable: false,
            maximizable: false
        });
        $('#win_main_2').window('center');
        $('#win_main_2').window('open');
    }
    function removeLastBeforeCss() {
        var accordions = $(".menu_accordion");
        var lastli = null;
        for(var i=0;i<accordions.length;i++){
            lastli = $(accordions[i]).find("li:last");
            $(lastli).removeClass("before");
        }
    }
</script>
</body>
</html>
